public class Test {
    public static int countSegments(String s) {
        if (s.length() == 0)
            return 0;
        String[] ret = s.split(" ");
        int count = 0;
        for (String s1 : ret) {
            if (s1.length() != 0) {
                count++;
            }
        }
        return count;
    }

    public boolean isUpper(char ch) {
        if (ch > 'A' && ch < 'Z') {
            return true;
        }

        return false;
    }

    public String toLowerCase(String s) {
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (isUpper(ch)) {
                ch = (char) (ch + 32);
                stringBuffer.append(ch);
            } else {
                stringBuffer.append(ch);
            }
        }
        return stringBuffer.toString();
    }
}

